﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.SQLite;
namespace ToolsCollection.DAL
{
  public  class TC_BAGLIST
    {
        /// <summary>
        /// 获取任务包列表
        /// </summary>
        /// <param name="names">包名称</param>
        /// <returns></returns>
        public DataTable GetTC_BagList(string names)
        {
            string sql = "select * from tc_baglist where baglist_name like '%" + names + "%'";
            DataSet tempDS = ToolsCollection.Helper.SqliteHelper.Query(sql);
            return tempDS.Tables[0];
        }
        /// <summary>
        /// 添加任务包
        /// </summary>
        /// <param name="tc_BagList"></param>
        /// <returns></returns>
        public int Add_TC_Bag(ToolsCollection.MODEL.TC_BAGLIST tc_BagList)
        {
            string sql = "insert into tc_baglist(baglist_id,baglist_name,baglist_add_time,baglist_path) values(null,'" + tc_BagList.BagList_Name + "','" + System.DateTime.Now + "','" + tc_BagList.BagList_Path + "')";
            int result = ToolsCollection.Helper.SqliteHelper.ExecuteNonQuery(ToolsCollection.Helper.SqliteHelper.ConnString, new SQLiteCommand() { CommandText = sql });
            return result;
        }

    }
}
